﻿using Sidvall.UI.Entities;
using Sidvall.UI.Uwp.Test.ViewModels;
using Windows.Foundation;
using Windows.UI.ViewManagement;
using Windows.UI.Xaml.Controls;

namespace Sidvall.UI.Uwp.Test
{
    public sealed partial class MainPage : Page
    {
        #region Public Members

        #region ViewModel

        public MainWindowViewModel ViewModel
        {
            get
            {
                return (MainWindowViewModel)this.DataContext;
            }
            set
            {
                this.DataContext = value;
            }
        }

        #endregion

        #endregion
        #region Events

        private async void HamburgerMenu_ItemClick(object sender, ItemClickEventArgs e)
        {
            var item = e.ClickedItem as MenuItem;
            await this.ViewModel.SelectMenuItemAsync(item.Id);
        }
        private async void HamburgerMenu_OptionsItemClick(object sender, ItemClickEventArgs e)
        {
            var item = e.ClickedItem as MenuItem;
            await this.ViewModel.SelectOptionItemAsync(item.Id);
        }

        #endregion
        #region Constructors

        public MainPage()
        {
            this.InitializeComponent();

            ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(300, 300));
        }

        #endregion
    }
}
